#ifndef TEXT_RENDERER_H
#define TEXT_RENDERER_H

#include <map>

#include <glad/glad.h>
#include <glm/glm.hpp>

#include "texture.h"
#include "shader.h"


//character infomation
struct Character {
    unsigned int TextureID; 
    glm::ivec2   Size;     
    glm::ivec2   Bearing;   // offset from baseline
    unsigned int Advance;   // horizontal offset 
};


//rendering text
class TextRenderer
{
public:
    
    std::map<char, Character> Characters;
    // shader used for text rendering
    Shader TextShader;
    TextRenderer(unsigned int width, unsigned int height);
    // pre-compiles
    void Load(std::string font, unsigned int fontSize);
    // renders a string of text
    void RenderText(std::string text, float x, float y, float scale, glm::vec3 color = glm::vec3(1.0f));
private:
    // render state
    unsigned int VAO, VBO;
};

#endif 